﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Booking_Hotel.DBML;

namespace Booking_Hotel.DAL
{
    public class Supplier_DichVuDAO
    {
        ThanhBHotelDataContext sdb = new ThanhBHotelDataContext();

        public Supplier_Hotel_DichVu GetSupplier_Hotel_DichVuByID(int ID)
        {
            return sdb.sp_Supplier_Hotel_DichVu_Select(ID).SingleOrDefault();
        }

        public void addSupplier_Hotel_DichVu(Supplier_Hotel_DichVu shd)
        {
            Supplier_Hotel_DichVu add = new Supplier_Hotel_DichVu
            {

                Supplier_HotelID = shd.Supplier_HotelID,
                TenDichVu = shd.TenDichVu,
                Description = shd.Description,
                GiaDichVu = shd.GiaDichVu
               
            };
            sdb.Supplier_Hotel_DichVus.InsertOnSubmit(add);
            sdb.SubmitChanges();
        }

        public void updateSupplier_Hotel_DichVu(Supplier_Hotel_DichVu shd)
        {
            Supplier_Hotel_DichVu update = sdb.Supplier_Hotel_DichVus.Single(ca => ca.Supplier_Hotel_DichVuID== (int)shd.Supplier_Hotel_DichVuID);
            {
                update.Supplier_Hotel_DichVuID = shd.Supplier_Hotel_DichVuID;
                update.Supplier_HotelID = shd.Supplier_HotelID;
                update.TenDichVu = shd.TenDichVu;
                update.Description = shd.Description;
                update.GiaDichVu = shd.GiaDichVu;
            }
            sdb.SubmitChanges();
         }
    }
}